//管理这个项目的所有接口
import axios from 'axios';
import request from './request'

// 请求首页的数据
export const GetHomeLists = () => request.get('/index/index')
//以上系箭头函数写法
//export const GetHomeData = function(){
// return axios.get('/index/index');
// }

//请求搜索页面数据
export const GetSearchPopupData = () => request.get('/search/index')

//请求搜索页提示页面数据
export const SearchTipsListData = (params) => request.get('/search/helper', { params });

//搜索框商品的搜索请求
export const GetSearchData = (params) => request.get('/goods/list', { params });


//清除历史记录
export const Clearhistory = (params) => request.post('/search/clearhistory', params);


//登录接口（没有账号自动注册）
export const UserLogin = (params) => request.post('/auth/loginByWeb', params);

//产品明细
export const GetGoodsDetail = (params) => request.get('/goods/detail', { params });

//新品-相关产品
export const GetRelated = (params) => request.get('/goods/related', { params });

//获取购物车产品数量
export const GetCartNumber = (params) => request.get('/cart/goodscount', { params });

//加入购物车
export const ToAddCart = (params) => request.post('/cart/add', params);

//获取购物车数据（含完成编辑）
export const GetCartListData = () => request.get('/cart/index');

//点击切换商品选中状态（含全选）
export const cartChecked = (params) => request.post('/cart/checked', params);

//商品步进器
export const cartUpdate = (params) => request.post('cart/update', params);

//删除商品
export const cartDelete = (params) => request.post('/cart/delete', params);

//页面数据请求
export const topicList = (params) => request.get('/topic/list', { params });


//全部分类数据接口
export const catalogIndex = () => request.get('/catalog/index');


//获取当前分类数据
export const catalogCurrent = (params) => request.get('/catalog/current', { params });

//分类数据获取
export const goodsCategory = (params) => request.get('/goods/category', { params });